import request from '@/config/axios'

// 用户答案 VO
export interface UserAnswerVO {
  id: number // 主键id,即答案Id
  userId: number // 用户Id
  questionId: number // 问题id
  questionContent: string // 问题内容
  userAnswer: string // 用户答案内容
  answerNo: number // 用户第多少次答题
}

// 用户答案 API
export const UserAnswerApi = {
  // 查询用户答案分页
  getUserAnswerPage: async (params: any) => {
    return await request.get({ url: `/system/userAnswer/page`, params })
  },

  // 查询用户答案详情
  getUserAnswer: async (id: number) => {
    return await request.get({ url: `/system/user-answer/get?id=` + id })
  },

  // 新增用户答案
  createUserAnswer: async (data: UserAnswerVO) => {
    return await request.post({ url: `/system/user-answer/create`, data })
  },

  // 修改用户答案
  updateUserAnswer: async (data: UserAnswerVO) => {
    return await request.put({ url: `/system/user-answer/update`, data })
  },

  // 删除用户答案
  deleteUserAnswer: async (id: number) => {
    return await request.delete({ url: `/system/user-answer/delete?id=` + id })
  },

  // 导出用户答案 Excel
  exportUserAnswer: async (params) => {
    return await request.download({ url: `/system/user-answer/export-excel`, params })
  },
}
